﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BookStore.Data;
using BookStore.Bussiness;

namespace BookStore.Controls
{
    public partial class Header : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Panel1.Enabled = true;
            string s = " Welcome visitor you can <a href='Login.aspx'>Login</a> or <a href='Register.aspx'>Create an account</a>";
            //string t = " Welcome visitor you can";
            if (Session["Customer"] != null)
            {
                Label1.Text = "Wellcome: " + Session["Customer"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                Panel1.Enabled = false;
                lblloguot.Text = "Logout";
            }
            else
            {
               
                ltlacount.Text = s;
                Panel1.Enabled = true;
                Panel2.Enabled = false;
            }

            //GetCart();
            
        }
        private void GetCart() 
        {
            Cart objCart = new Cart();
            if (Session["cart"] != null)
                objCart = (Cart)Session["cart"];
           
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
           // Response.Redirect("Search.aspx?Text=" + txtsearch.Text);
            Response.Redirect("Search.aspx?Keywords=" + txtsearch.Text);
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Response.Redirect("Checkcart.aspx");
        }

        protected void lbncart_Click(object sender, EventArgs e)
        {
            if (Session["cart"] == null)
            {

            }
            else Response.Redirect("Checkcart.aspx");
        }
    }
}